package com.guoyh.bilbase.ext

import com.lxj.xpopup.XPopup
import com.lxj.xpopup.core.BasePopupView


/**
 * @CreateDate: 2021/9/28 1:46 下午
 * @Author: guoyh
 * @Description: java类作用描述
 */
fun BasePopupView.showPop(isBack: Boolean = true, isTouch: Boolean = true) {
    XPopup.Builder(context) //               .moveUpToKeyboard(false)
        .dismissOnBackPressed(isBack) // 按返回键是否关闭弹窗，默认为true
        .dismissOnTouchOutside(isTouch) // 点击外部是否关闭弹窗，默认为true
        .asCustom(this)
        .show()
}

fun BasePopupView.showPopInit(init: (XPopup.Builder) -> Unit): BasePopupView {
    val showPop = XPopup.Builder(context)
    init.invoke(showPop)
    showPop.asCustom(this).show()
    return this
}